package com.platform.modules.wallet.domain;

import cn.hutool.crypto.SecureUtil;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * <p>
 * 每日账单
 * </p>
 */
@Data
@TableName("wallet_daily_bill")
@Accessors(chain = true) // 链式调用
public class WalletDailyBill extends Model<WalletDailyBill> {

    /**
     * 主键
     */
    @TableId
    private Long id;
    private Integer amount;
    private Integer balance;
    private Date createTime;
    private Date createDate;
    private Long userId;
    private String privateKey;


    public String getKey(){
        StringBuffer sb=new StringBuffer();
        sb.append(userId);
        sb.append(amount);
        sb.append(createDate.getTime());
        sb.append(createTime.getTime());
        return SecureUtil.md5(sb.toString());
    }
}
